package yhao.infra.web.interceptor.logger.context;

import yhao.infra.apilist.ValidationForm;

import java.util.UUID;

/**
 * 继承该类需要实现无参构造器
 */
public class RequestContext {
    private String sessionId;
    private String requestId;
    private long timeKey;
    private boolean debug;
    private String appName;
    private String errMsg;
    private ValidationForm form;

    public RequestContext() {
        requestId = UUID.randomUUID().toString();
        timeKey = System.currentTimeMillis();
        debug = false;
    }

    public String getSessionId() {
        return sessionId;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

    public String getRequestId() {
        return requestId;
    }

    public void setRequestId(String request){
        this.requestId = request;
    }

    public long getTimeKey() {
        return timeKey;
    }

    public boolean isDebug() {
        return debug;
    }

    public void setDebug(boolean debug) {
        this.debug = debug;
    }

    public String getAppName() {
        return appName;
    }

    public RequestContext setAppName(String appName) {
        this.appName = appName;
        return this;
    }

    public String getErrMsg() {
        return errMsg;
    }

    public void setErrMsg(String errMsg) {
        this.errMsg = errMsg;
    }

    public ValidationForm getForm() {
        return form;
    }

    public void setForm(ValidationForm form) {
        this.form = form;
    }
}